package cn.base.web.cahe;

import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.CacheManager;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import java.util.*;

@Component
@Slf4j
public class RedisCacheService {

	@Autowired(required = false)
	private RedisTemplate<Object, Object> redisTemplate;
	
	
	
	public Object hashGet(String key) {
		Map<Object,Object> map=new HashMap<Object,Object>();
		Set<Object> keySet=redisTemplate.opsForHash().keys(key);
		Iterator<Object> it=keySet.iterator();
		List<Object> list=redisTemplate.opsForHash().multiGet(key, keySet);
		if(list!=null) {
			for(Object o:list) {
				map.put(it.next(),o);
			}
		}
		return map;
	}
	
	
	public Object getCache(String cacheName) {
		return null;
	}
}
